if($.validator != null) {
$.extend($.validator.messages, {
    required: "必填",
	email: "请输入正确的邮箱地址",
//	url: message("admin.validate.url"),
//	date: message("admin.validate.date"),
//	dateISO: message("admin.validate.dateISO"),
//	pointcard: message("admin.validate.pointcard"),
//	number: message("admin.validate.number"),
	digits: "只允许输入零或正整数"
//	minlength: $.validator.format(message("admin.validate.minlength")),
//	maxlength: $.validator.format(message("admin.validate.maxlength")),
//	rangelength: $.validator.format(message("admin.validate.rangelength")),
//	min: $.validator.format(message("admin.validate.min")),
//	max: $.validator.format(message("admin.validate.max")),
//	range: $.validator.format(message("admin.validate.range")),
//	accept: message("admin.validate.accept"),
//	equalTo: message("admin.validate.equalTo"),
//	remote: message("admin.validate.remote"),
//	integer: message("admin.validate.integer"),
//	positive: message("admin.validate.positive"),
//	negative: message("admin.validate.negative"),
//	decimal: message("admin.validate.decimal"),
//	pattern: message("admin.validate.pattern"),
//	extension: message("admin.validate.extension")
});
}

$.validator.setDefaults({
	errorClass: "fieldError",
	ignore: ".ignore",
	ignoreTitle: true,
	errorPlacement: function(error, element) {
		var fieldSet = element.closest("span.fieldSet");
		if (fieldSet.size() > 0) {
			error.appendTo(fieldSet);
		} else {
			error.insertAfter(element);
		}
	}
});

jQuery.validator.addMethod("pattern", function(value, element, param) {
	return this.optional(element) || param.test(value);
	}, "非法字符");

//联系电话(手机/电话皆可)验证   
jQuery.validator.addMethod("isPhone", function(value,element) {
	var length = value.length;
	var mobile = /^1[358]\d{9}$/;
	return this.optional(element) || (length == 11 && mobile.test(value));
	}, "请填写正确的手机号码");

//时间验证
jQuery.validator.addMethod("isDate",function(value,element){
	
	if(value == -1 || value.trim() == "") return true;
	
	var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/;
	if(value.match(reg)){
		
		var result = isNaN((new Date(value)).getTime());
	    return !result;
	}
	
	return false;
	},"请正确选取时间");

//地区验证
jQuery.validator.addMethod("isDistrict",function(value,element){
	
	if(value == -1 || value.trim() == ""){
		return true;
	}
	
	var strArray = value.split(";");
	if(strArray.length != 4 || strArray[0] == -1 || strArray[1] == -1
			|| strArray[2] == -1) return false;
	
	return true;
	},"请正确选取地区");

jQuery.validator.addMethod("isPostcode", function(value, element) {   
    var tel = /^[0-9]{6}$/;
    return this.optional(element) || (tel.test(value));
}, "请正确填写您的邮政编码");

//判断浮点数value是否大于0
jQuery.validator.addMethod("isFloatGtZero", function(value, element) { 
     return this.optional(element) || /^[+]?\d+(\.\d+)?$/.test(value);       
}, "请输入数字");

//判断内容是否和提供的内容不一样
jQuery.validator.addMethod("notEqual", function(value, element, param) {

	if(value && value.trim() != param){
		return true;
	}
	return false;
}, "请输入内容");